# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: team/kde <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-frameworks
pkgname=kcontacts
pkgver=6.1.0
pkgrel=0
pkgdesc="Address book API for KDE"
arch="all !armhf" # armhf blocked by extra-cmake-modules
url="https://community.kde.org/Frameworks"
license="LGPL-2.0-or-later"
# TODO: Replace gnupg with specific gnupg subpackages that kcontacts really needs.
depends="
	gnupg
	iso-codes
	"
depends_dev="
	kcodecs-dev
	kconfig-dev
	kcoreaddons-dev
	ki18n-dev
	qt6-qtbase-dev
	"
makedepends="$depends_dev
	doxygen
	extra-cmake-modules
	graphviz
	qt6-qttools-dev
	samurai
	"
checkdepends="xvfb-run"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
_repo_url="https://invent.kde.org/frameworks/kcontacts.git"
source="https://download.kde.org/stable/frameworks/${pkgver%.*}/kcontacts-$pkgver.tar.xz"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_QCH=ON
	cmake --build build
}

check() {
	# kcontacts-addresstest requires Wayland display
	xvfb-run ctest --test-dir build --output-on-failure -E "kcontacts-addresstest"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
3173f9bb6cd55fb5e0035c6fd828a9ab26dbfeb7df54c215c45f60674a12005e15c4597e7a0365b964df5797c9cb430a489e8e08559510a4e1242663a2dd9c00  kcontacts-6.1.0.tar.xz
"
